﻿using System;
using System.Globalization;


namespace BizElements.BusinessLayer
{
    /// <summary>
    /// Contains format providers for common types and implements formatting logic.
    /// </summary>
    public interface IMessageFormatter
    {
        #region Methods.

        /// <summary>
        /// Formats the given value.
        /// </summary>
        /// <param name="val">Value to be formatted.</param>
        /// <returns>String representation of the given value.</returns>
        string Format(object val);

        /// <summary>
        /// Formats the given value.
        /// </summary>
        /// <param name="val">Value to be formatted.</param>
        /// <param name="forcedType">Forces the usage of conversion and format specified for the given type.</param>
        /// <returns>String representation of the given value.</returns>
        string Format(object val, Type forcedType);

        /// <summary>
        /// Gets format used to format values of the given type.
        /// </summary>
        /// <param name="t">Type of value to be formatted.</param>
        /// <returns>Value format.</returns>
        string GetFormat(Type t);

        #endregion

        #region Properties.

        /// <summary>
        /// An <see cref="IFormatProvider"/> object used for all types unless specific provider exists.
        /// </summary>
        IFormatProvider DefaultProvider { get; }

        /// <summary>
        /// An <see cref="IFormatProvider"/> object used to format integer values.
        /// </summary>
        IFormatProvider IntProvider { get; }

        /// <summary>
        /// Format for integer values.
        /// </summary>
        string IntFormat { get; }

        /// <summary>
        /// <see cref="NumberStyles"/> which indicates the permitted format of strings representing integer values.
        /// </summary>
        NumberStyles IntStyle { get; }

        /// <summary>
        /// An <see cref="IFormatProvider"/> object used to format floating point numbers.
        /// </summary>
        IFormatProvider RealProvider { get; }

        /// <summary>
        /// Format for floating point numbers.
        /// </summary>
        string RealFormat { get; }

        /// <summary>
        /// <see cref="NumberStyles"/> which indicates the permitted format of strings representing floating point numbers.
        /// </summary>
        NumberStyles RealStyle { get; }

        /// <summary>
        /// An <see cref="IFormatProvider"/> object used to format DateTime values.
        /// </summary>
        IFormatProvider DateProvider { get; }

        /// <summary>
        /// Format for DateTime values.
        /// </summary>
        string DateFormat { get; }

        /// <summary>
        /// <see cref="DateTimeStyles"/> which indicates the permitted format of strings representing <b>DateTime</b> values.
        /// </summary>
        DateTimeStyles DateStyle { get; }

        #endregion
    }
}